<template>
	<!--<section>
		<game-header :gameDatas='gameDatas'></game-header>
		<div class="scroll-content has-header">
		    <game-top :gameDatas='gameDatas'></game-top>
		    <game-tab></game-tab>
		</div>
	</section>-->
	<keep-alive>
		<component :is="myGame" :nowWanfaList="nowWanfaList"></component>
	</keep-alive>
</template>

<script>
	import cqssc from './gameList/cqssc'
	import bjpk10 from './gameList/bjpk10'
	import lhc from './gameList/lhc'
	import pl3 from './gameList/pl3'
	import sfpk10 from './gameList/sfpk10'
	import sfssc from './gameList/sfssc'
	import ssc from './gameList/ssc'
	import syx5 from './gameList/syx5'
	
	export default {
		data () {
			return {
				myGame: 'my-cqssc',
				wanfaList: [],
				nowWanfaList: []
			}
		},
		created () {
			let list = this.$store.state.allGameList
//  		console.log(list)
    		let locallist = JSON.parse(window.sessionStorage.getItem('allGameList'))
//			console.log(locallist)
			if(list) {
				this.wanfaList = list
			} else {
				this.wanfaList = locallist
			}
		},
		mounted () {
			// 保存根据路由跳转传入的ticketId
			var wanfaID = this.$route.params.ticketId
			// 根据保存的这个wanfaID来遍历请求到的全部的玩法数据wanfaList
			this.wanfaList.forEach(item => {
				if(item.ticketId == wanfaID) {
					// 把符合当前ticketId的数据保存到当前玩法数据nowWanfaList中
					this.nowWanfaList = item
				}
			})
			console.log(this.nowWanfaList)
		},
		components: {
			'my-cqssc': cqssc,
			'my-bjpk10': bjpk10,
			'my-lhc': lhc,
			'my-pl3': pl3,
			'my-sfpk10': sfpk10,
			'my-sfssc': sfssc,
			'my-ssc': ssc,
			'my-syx5': syx5
		}
	}
</script>

<style lang="less" scoped>
</style>
